<?php
/**
 * @package     sc2szeged
 * @subpackage  com_jtengine
 * @author		Zoltan Kiss http://www.kisszoltan.hu
 * @license     Lesser General Public License version 3 or later
 */
defined( '_JEXEC' ) or die( 'Restricted access' );

JLoader::register('JTEController', JPATH_COMPONENT.DS.'controllers'.DS.'controller.php');
JLoader::register('JTEModel', JPATH_COMPONENT.DS.'models'.DS.'model.php');
JLoader::register('JTEView', JPATH_COMPONENT.DS.'views'.DS.'view.php');
// JLoader::register('JTEHelperRoute', JPATH_COMPONENT.DS.'helpers'.DS.'route.php');
// JLoader::register('JTEHelperPermissions', JPATH_COMPONENT.DS.'helpers'.DS.'permissions.php');
// JLoader::register('JTEHelperUtilities', JPATH_COMPONENT.DS.'helpers'.DS.'utilities.php');

$controller = JRequest::getWord('view', 'list');
$task = JRequest::getWord('task');

// jimport('joomla.filesystem.file');
// jimport('joomla.html.parameter');

if (JFile::exists(JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php'))
{
	require_once (JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php');
	$classname = 'JTEController'.$controller;
	$controller = new $classname();
	$controller->execute($task);
	$controller->redirect();
}
else
{
	JError::raiseError(404, JText::_('JTE_NOT_FOUND'));
}

if (JRequest::getCmd('format') != 'json')
{
	echo "\n<!-- SC2Szeged \"jTEngine\" (v1.0.0) -->\n\n";
}